/**
 * 自定义的console，可以用来实现控制台滚动输出
 */
const customConsole = {
  stream: process.stderr,
  // 追加
  log(text) {
    this.stream.write(`${text}`);
  },
  logBr(text) {
    this.log(text);
    this.br();
  },
  // 覆盖
  cover(text) {
    this.stream.cursorTo(0);
    this.log(text);
  },
  // 覆盖并换行，换行后将不会再被覆盖
  coverBr(text) {
    this.cover(text);
    this.br();
  },
  // 换行
  br() {
    this.stream.write("\n");
  },
};

module.exports = customConsole;